<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Voro++: c_loops.cc Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Voro++
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript" src="dynsections.js"></script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">c_loops.cc</div>  </div>
</div>
<div class="contents">
<a href="c__loops_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Voro++, a 3D cell-based Voronoi library</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// Author   : Chris H. Rycroft (LBL / UC Berkeley)</span>
<a name="l00004"></a>00004 <span class="comment">// Email    : chr@alum.mit.edu</span>
<a name="l00005"></a>00005 <span class="comment">// Date     : August 30th 2011</span>
<a name="l00006"></a>00006 <span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment">/** \file c_loops.cc</span>
<a name="l00008"></a>00008 <span class="comment"> * \brief Function implementations for the loop classes. */</span>
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="preprocessor">#include &quot;<a class="code" href="c__loops_8hh.html" title="Header file for the loop classes.">c_loops.hh</a>&quot;</span>
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 <span class="keyword">namespace </span>voro {
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">/** Initializes a c_loop_subset object to scan over all particles within a</span>
<a name="l00015"></a>00015 <span class="comment"> * given sphere.</span>
<a name="l00016"></a>00016 <span class="comment"> * \param[in] (vx,vy,vz) the position vector of the center of the sphere.</span>
<a name="l00017"></a>00017 <span class="comment"> * \param[in] r the radius of the sphere.</span>
<a name="l00018"></a>00018 <span class="comment"> * \param[in] bounds_test whether to do detailed bounds checking. If this is</span>
<a name="l00019"></a>00019 <span class="comment"> *                        false then the class will loop over all particles in</span>
<a name="l00020"></a>00020 <span class="comment"> *                        blocks that overlap the given sphere. If it is true,</span>
<a name="l00021"></a>00021 <span class="comment"> *                        the particle will only loop over the particles which</span>
<a name="l00022"></a>00022 <span class="comment"> *                        actually lie within the sphere.</span>
<a name="l00023"></a>00023 <span class="comment"> * \return True if there is any valid point to loop over, false otherwise. */</span>
<a name="l00024"></a><a class="code" href="classvoro_1_1c__loop__subset.html#a585f47e725dc0de645defc8dc0d463cb">00024</a> <span class="keywordtype">void</span> <a class="code" href="classvoro_1_1c__loop__subset.html#a585f47e725dc0de645defc8dc0d463cb">c_loop_subset::setup_sphere</a>(<span class="keywordtype">double</span> vx,<span class="keywordtype">double</span> vy,<span class="keywordtype">double</span> vz,<span class="keywordtype">double</span> r,<span class="keywordtype">bool</span> bounds_test) {
<a name="l00025"></a>00025         <span class="keywordflow">if</span>(bounds_test) {<a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>=sphere;v0=vx;v1=vy;v2=vz;v3=r*r;} <span class="keywordflow">else</span> <a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>=no_check;
<a name="l00026"></a>00026         ai=step_int((vx-ax-r)*xsp);
<a name="l00027"></a>00027         bi=step_int((vx-ax+r)*xsp);
<a name="l00028"></a>00028         aj=step_int((vy-ay-r)*ysp);
<a name="l00029"></a>00029         bj=step_int((vy-ay+r)*ysp);
<a name="l00030"></a>00030         ak=step_int((vz-az-r)*zsp);
<a name="l00031"></a>00031         bk=step_int((vz-az+r)*zsp);
<a name="l00032"></a>00032         setup_common();
<a name="l00033"></a>00033 }
<a name="l00034"></a>00034 <span class="comment"></span>
<a name="l00035"></a>00035 <span class="comment">/** Initializes the class to loop over all particles in a rectangular subgrid</span>
<a name="l00036"></a>00036 <span class="comment"> * of blocks.</span>
<a name="l00037"></a>00037 <span class="comment"> * \param[in] (ai_,bi_) the subgrid range in the x-direction, inclusive of both</span>
<a name="l00038"></a>00038 <span class="comment"> *                      ends.</span>
<a name="l00039"></a>00039 <span class="comment"> * \param[in] (aj_,bj_) the subgrid range in the y-direction, inclusive of both</span>
<a name="l00040"></a>00040 <span class="comment"> *                      ends.</span>
<a name="l00041"></a>00041 <span class="comment"> * \param[in] (ak_,bk_) the subgrid range in the z-direction, inclusive of both</span>
<a name="l00042"></a>00042 <span class="comment"> *                      ends.</span>
<a name="l00043"></a>00043 <span class="comment"> * \return True if there is any valid point to loop over, false otherwise. */</span>
<a name="l00044"></a><a class="code" href="classvoro_1_1c__loop__subset.html#a688ef02340f6a9bc64c77c2de4c4ae3d">00044</a> <span class="keywordtype">void</span> <a class="code" href="classvoro_1_1c__loop__subset.html#a688ef02340f6a9bc64c77c2de4c4ae3d">c_loop_subset::setup_intbox</a>(<span class="keywordtype">int</span> ai_,<span class="keywordtype">int</span> bi_,<span class="keywordtype">int</span> aj_,<span class="keywordtype">int</span> bj_,<span class="keywordtype">int</span> ak_,<span class="keywordtype">int</span> bk_) {
<a name="l00045"></a>00045         ai=ai_;bi=bi_;aj=aj_;bj=bj_;ak=ak_;bk=bk_;
<a name="l00046"></a>00046         <a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>=no_check;
<a name="l00047"></a>00047         setup_common();
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049 <span class="comment"></span>
<a name="l00050"></a>00050 <span class="comment">/** Sets up all of the common constants used for the loop.</span>
<a name="l00051"></a>00051 <span class="comment"> * \return True if there is any valid point to loop over, false otherwise. */</span>
<a name="l00052"></a>00052 <span class="keywordtype">void</span> c_loop_subset::setup_common() {
<a name="l00053"></a>00053         <span class="keywordflow">if</span>(!xperiodic) {
<a name="l00054"></a>00054                 <span class="keywordflow">if</span>(ai&lt;0) {ai=0;<span class="keywordflow">if</span>(bi&lt;0) bi=0;}
<a name="l00055"></a>00055                 <span class="keywordflow">if</span>(bi&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>) {bi=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>-1;<span class="keywordflow">if</span>(ai&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>) ai=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>-1;}
<a name="l00056"></a>00056         }
<a name="l00057"></a>00057         <span class="keywordflow">if</span>(!yperiodic) {
<a name="l00058"></a>00058                 <span class="keywordflow">if</span>(aj&lt;0) {aj=0;<span class="keywordflow">if</span>(bj&lt;0) bj=0;}
<a name="l00059"></a>00059                 <span class="keywordflow">if</span>(bj&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>) {bj=<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>-1;<span class="keywordflow">if</span>(aj&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>) aj=<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>-1;}
<a name="l00060"></a>00060         }
<a name="l00061"></a>00061         <span class="keywordflow">if</span>(!zperiodic) {
<a name="l00062"></a>00062                 <span class="keywordflow">if</span>(ak&lt;0) {ak=0;<span class="keywordflow">if</span>(bk&lt;0) bk=0;}
<a name="l00063"></a>00063                 <span class="keywordflow">if</span>(bk&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>) {bk=<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>-1;<span class="keywordflow">if</span>(ak&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>) ak=<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>-1;}
<a name="l00064"></a>00064         }
<a name="l00065"></a>00065         ci=ai;cj=aj;ck=ak;
<a name="l00066"></a>00066         di=<a class="code" href="classvoro_1_1c__loop__base.html#aef465d2da85b963fa9e0e886ee273541">i</a>=step_mod(ci,<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>);apx=px=step_div(ci,<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>)*sx;
<a name="l00067"></a>00067         dj=<a class="code" href="classvoro_1_1c__loop__base.html#abbaba2fc0d1fa07760220d37a3cc7ccf">j</a>=step_mod(cj,<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>);apy=py=step_div(cj,<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>)*sy;
<a name="l00068"></a>00068         dk=<a class="code" href="classvoro_1_1c__loop__base.html#abf2dcc131f23212c15169e90ba30d6e4">k</a>=step_mod(ck,<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>);apz=pz=step_div(ck,<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>)*sz;
<a name="l00069"></a>00069         inc1=di-step_mod(bi,<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>);
<a name="l00070"></a>00070         inc2=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>*(<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>+dj-step_mod(bj,<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>))+inc1;
<a name="l00071"></a>00071         inc1+=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>;
<a name="l00072"></a>00072         <a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>=di+<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>*(dj+<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>*dk);
<a name="l00073"></a>00073         <a class="code" href="classvoro_1_1c__loop__base.html#a2eaa096a64736b5792cdf3d799b95786">q</a>=0;
<a name="l00074"></a>00074 }
<a name="l00075"></a>00075 <span class="comment"></span>
<a name="l00076"></a>00076 <span class="comment">/** Starts the loop by finding the first particle within the container to</span>
<a name="l00077"></a>00077 <span class="comment"> * consider.</span>
<a name="l00078"></a>00078 <span class="comment"> * \return True if there is any particle to consider, false otherwise. */</span>
<a name="l00079"></a><a class="code" href="classvoro_1_1c__loop__subset.html#a4c9709bc992e33668471e292474c39f4">00079</a> <span class="keywordtype">bool</span> <a class="code" href="classvoro_1_1c__loop__subset.html#a4c9709bc992e33668471e292474c39f4">c_loop_subset::start</a>() {
<a name="l00080"></a>00080         <span class="keywordflow">while</span>(<a class="code" href="classvoro_1_1c__loop__base.html#a060e5b0e557141713b6897b0a0728f2d">co</a>[<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>]==0) {<span class="keywordflow">if</span>(!next_block()) <span class="keywordflow">return</span> <span class="keyword">false</span>;}
<a name="l00081"></a>00081         <span class="keywordflow">while</span>(<a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>!=no_check&amp;&amp;out_of_bounds()) {
<a name="l00082"></a>00082                 <a class="code" href="classvoro_1_1c__loop__base.html#a2eaa096a64736b5792cdf3d799b95786">q</a>++;
<a name="l00083"></a>00083                 <span class="keywordflow">while</span>(<a class="code" href="classvoro_1_1c__loop__base.html#a2eaa096a64736b5792cdf3d799b95786">q</a>&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#a060e5b0e557141713b6897b0a0728f2d">co</a>[<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>]) {<a class="code" href="classvoro_1_1c__loop__base.html#a2eaa096a64736b5792cdf3d799b95786">q</a>=0;<span class="keywordflow">if</span>(!next_block()) <span class="keywordflow">return</span> <span class="keyword">false</span>;}
<a name="l00084"></a>00084         }
<a name="l00085"></a>00085         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00086"></a>00086 }
<a name="l00087"></a>00087 <span class="comment"></span>
<a name="l00088"></a>00088 <span class="comment">/** Initializes the class to loop over all particles in a rectangular box.</span>
<a name="l00089"></a>00089 <span class="comment"> * \param[in] (xmin,xmax) the minimum and maximum x coordinates of the box.</span>
<a name="l00090"></a>00090 <span class="comment"> * \param[in] (ymin,ymax) the minimum and maximum y coordinates of the box.</span>
<a name="l00091"></a>00091 <span class="comment"> * \param[in] (zmin,zmax) the minimum and maximum z coordinates of the box.</span>
<a name="l00092"></a>00092 <span class="comment"> * \param[in] bounds_test whether to do detailed bounds checking. If this is</span>
<a name="l00093"></a>00093 <span class="comment"> *                        false then the class will loop over all particles in</span>
<a name="l00094"></a>00094 <span class="comment"> *                        blocks that overlap the given box. If it is true, the</span>
<a name="l00095"></a>00095 <span class="comment"> *                        particle will only loop over the particles which</span>
<a name="l00096"></a>00096 <span class="comment"> *                        actually lie within the box.</span>
<a name="l00097"></a>00097 <span class="comment"> * \return True if there is any valid point to loop over, false otherwise. */</span>
<a name="l00098"></a><a class="code" href="classvoro_1_1c__loop__subset.html#a2aba9be724d35e088e3597dc9181182d">00098</a> <span class="keywordtype">void</span> <a class="code" href="classvoro_1_1c__loop__subset.html#a2aba9be724d35e088e3597dc9181182d">c_loop_subset::setup_box</a>(<span class="keywordtype">double</span> xmin,<span class="keywordtype">double</span> xmax,<span class="keywordtype">double</span> ymin,<span class="keywordtype">double</span> ymax,<span class="keywordtype">double</span> zmin,<span class="keywordtype">double</span> zmax,<span class="keywordtype">bool</span> bounds_test) {
<a name="l00099"></a>00099         <span class="keywordflow">if</span>(bounds_test) {<a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>=box;v0=xmin;v1=xmax;v2=ymin;v3=ymax;v4=zmin;v5=zmax;} <span class="keywordflow">else</span> <a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>=no_check;
<a name="l00100"></a>00100         ai=step_int((xmin-ax)*xsp);
<a name="l00101"></a>00101         bi=step_int((xmax-ax)*xsp);
<a name="l00102"></a>00102         aj=step_int((ymin-ay)*ysp);
<a name="l00103"></a>00103         bj=step_int((ymax-ay)*ysp);
<a name="l00104"></a>00104         ak=step_int((zmin-az)*zsp);
<a name="l00105"></a>00105         bk=step_int((zmax-az)*zsp);
<a name="l00106"></a>00106         setup_common();
<a name="l00107"></a>00107 }
<a name="l00108"></a>00108 <span class="comment"></span>
<a name="l00109"></a>00109 <span class="comment">/** Computes whether the current point is out of bounds, relative to the</span>
<a name="l00110"></a>00110 <span class="comment"> * current loop setup.</span>
<a name="l00111"></a>00111 <span class="comment"> * \return True if the point is out of bounds, false otherwise. */</span>
<a name="l00112"></a>00112 <span class="keywordtype">bool</span> c_loop_subset::out_of_bounds() {
<a name="l00113"></a>00113         <span class="keywordtype">double</span> *pp=<a class="code" href="classvoro_1_1c__loop__base.html#a2b6abbe65d550ae7071aaa28d0fbb534">p</a>[<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>]+<a class="code" href="classvoro_1_1c__loop__base.html#ab42c93bbaf7cfc11e3c95f5d38f694e2">ps</a>*<a class="code" href="classvoro_1_1c__loop__base.html#a2eaa096a64736b5792cdf3d799b95786">q</a>;
<a name="l00114"></a>00114         <span class="keywordflow">if</span>(<a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>==sphere) {
<a name="l00115"></a>00115                 <span class="keywordtype">double</span> fx(*pp+px-v0),fy(pp[1]+py-v1),fz(pp[2]+pz-v2);
<a name="l00116"></a>00116                 <span class="keywordflow">return</span> fx*fx+fy*fy+fz*fz&gt;v3;
<a name="l00117"></a>00117         } <span class="keywordflow">else</span> {
<a name="l00118"></a>00118                 <span class="keywordtype">double</span> f(*pp+px);<span class="keywordflow">if</span>(f&lt;v0||f&gt;v1) <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00119"></a>00119                 f=pp[1]+py;<span class="keywordflow">if</span>(f&lt;v2||f&gt;v3) <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00120"></a>00120                 f=pp[2]+pz;<span class="keywordflow">return</span> f&lt;v4||f&gt;v5;
<a name="l00121"></a>00121         }
<a name="l00122"></a>00122 }
<a name="l00123"></a>00123 <span class="comment"></span>
<a name="l00124"></a>00124 <span class="comment">/** Returns the next block to be tested in a loop, and updates the periodicity</span>
<a name="l00125"></a>00125 <span class="comment"> * vector if necessary. */</span>
<a name="l00126"></a>00126 <span class="keywordtype">bool</span> c_loop_subset::next_block() {
<a name="l00127"></a>00127         <span class="keywordflow">if</span>(<a class="code" href="classvoro_1_1c__loop__base.html#aef465d2da85b963fa9e0e886ee273541">i</a>&lt;bi) {
<a name="l00128"></a>00128                 <a class="code" href="classvoro_1_1c__loop__base.html#aef465d2da85b963fa9e0e886ee273541">i</a>++;
<a name="l00129"></a>00129                 <span class="keywordflow">if</span>(ci&lt;<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>-1) {ci++;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>++;} <span class="keywordflow">else</span> {ci=0;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>+=1-<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>;px+=sx;}
<a name="l00130"></a>00130                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00131"></a>00131         } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="classvoro_1_1c__loop__base.html#abbaba2fc0d1fa07760220d37a3cc7ccf">j</a>&lt;bj) {
<a name="l00132"></a>00132                 <a class="code" href="classvoro_1_1c__loop__base.html#aef465d2da85b963fa9e0e886ee273541">i</a>=ai;ci=di;px=apx;<a class="code" href="classvoro_1_1c__loop__base.html#abbaba2fc0d1fa07760220d37a3cc7ccf">j</a>++;
<a name="l00133"></a>00133                 <span class="keywordflow">if</span>(cj&lt;<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>-1) {cj++;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>+=inc1;} <span class="keywordflow">else</span> {cj=0;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>+=inc1-<a class="code" href="classvoro_1_1c__loop__base.html#abb655606af4e184c2982f1a32cd47e12">nxy</a>;py+=sy;}
<a name="l00134"></a>00134                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00135"></a>00135         } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="classvoro_1_1c__loop__base.html#abf2dcc131f23212c15169e90ba30d6e4">k</a>&lt;bk) {
<a name="l00136"></a>00136                 <a class="code" href="classvoro_1_1c__loop__base.html#aef465d2da85b963fa9e0e886ee273541">i</a>=ai;ci=di;<a class="code" href="classvoro_1_1c__loop__base.html#abbaba2fc0d1fa07760220d37a3cc7ccf">j</a>=aj;cj=dj;px=apx;py=apy;<a class="code" href="classvoro_1_1c__loop__base.html#abf2dcc131f23212c15169e90ba30d6e4">k</a>++;
<a name="l00137"></a>00137                 <span class="keywordflow">if</span>(ck&lt;<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>-1) {ck++;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>+=inc2;} <span class="keywordflow">else</span> {ck=0;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>+=inc2-<a class="code" href="classvoro_1_1c__loop__base.html#a68cafa132e9028ed7b143e93e85a102d">nxyz</a>;pz+=sz;}
<a name="l00138"></a>00138                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00139"></a>00139         } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00140"></a>00140 }
<a name="l00141"></a>00141 <span class="comment"></span>
<a name="l00142"></a>00142 <span class="comment">/** Extends the memory available for storing the ordering. */</span>
<a name="l00143"></a>00143 <span class="keywordtype">void</span> particle_order::add_ordering_memory() {
<a name="l00144"></a>00144         <span class="keywordtype">int</span> *no=<span class="keyword">new</span> <span class="keywordtype">int</span>[<a class="code" href="classvoro_1_1particle__order.html#a742bc941dfd87ecd64b42f6e50df19db">size</a>&lt;&lt;2],*nop=no,*opp=<a class="code" href="classvoro_1_1particle__order.html#af8bef46cbdfdee608090aa5df0666df2">o</a>;
<a name="l00145"></a>00145         <span class="keywordflow">while</span>(opp&lt;<a class="code" href="classvoro_1_1particle__order.html#a6aeb89179930977f344416a0ba1c38a4">op</a>) *(nop++)=*(opp++);
<a name="l00146"></a>00146         <span class="keyword">delete</span> [] <a class="code" href="classvoro_1_1particle__order.html#af8bef46cbdfdee608090aa5df0666df2">o</a>;
<a name="l00147"></a>00147         <a class="code" href="classvoro_1_1particle__order.html#a742bc941dfd87ecd64b42f6e50df19db">size</a>&lt;&lt;=1;<a class="code" href="classvoro_1_1particle__order.html#af8bef46cbdfdee608090aa5df0666df2">o</a>=no;<a class="code" href="classvoro_1_1particle__order.html#a6aeb89179930977f344416a0ba1c38a4">op</a>=nop;
<a name="l00148"></a>00148 }
<a name="l00149"></a>00149 
<a name="l00150"></a>00150 }
</pre></div></div>
</div>


<hr class="footer"/><address class="footer"><small>
Generated on Fri Sep 23 2011 22:49:06 for Voro++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
